<%= stylesheet_link_tag 'ui.datepicker' %>
<%= javascript_include_tag 'ui.datepicker' %>
<%= javascript_include_tag 'ui.datepicker-zh-CN' %>
<%= javascript_include_tag 'mine' %>

<h3>我的订单</h3>
<table class="order_list">
  <thead>
    <tr>
      <th>单号</th>
      <th>金额</th>
      <th>下单日期</th>
      <th>状态</th>
      <th>送货方式</th>
      <th></th>
      <% if merchandiser? %>
        <th></th>
        <th></th>
      <%end%>
    </tr>
  </thead>

  <tbody>
    <% if @orders.length > 0 %>
      <% for order in @orders %>
        <tr>
          <td><%=order.id%></td>
          <td><%=order.total_price%></td>
          <td><%=order.created_at.strftime("%y-%m-%d %I:%M%p")%></td>
          <td><%=format_status order.status%></td>
          <td><%=format_shipping_type order.shipping_type%></td>
          <td class="action_link"><a href="/orders/<%=order.id%>" class='action_more'>查看</a></td>
          <% if merchandiser? %>
            <td class="action_link"><a href="/store/print?id=<%=order.id%>" class='action_print'>打印</a></td>
            <td class="action_link"><%= link_to '删除', order, :confirm => '确定删除订单?', :method => :delete,:class=>'action_delete'%></td>
          <%end%>
        </tr>
      <% end %>
    <%else%>
      <tr>
        <td colspan="9" style="text-align:center">
          暂无订单
        </td>
      </tr>
    <%end%>
  </tbody>
  <tfoot>
    <tr>
      <th  colspan="9" style="text-align:right" class="action_link">
        <form action="" method="get" >
          日期:由<input  type="text"  name="start_date" size="10" id='start_date' ></input>
          至<input  type="text"  name="end_date" size="10" id="end_date" ></input>

          状态:<%=select_tag(:status,options_for_select(Order::STATUS,params[:status]))%>
          <input   type="submit" value="筛选" ></input>
          <% if params[:status] && admin? %>
            <a href="/store/print?status=<%=params[:status]%>&start_date=<%=params[:start_date]%>&end_date=<%=params[:end_date]%>" class="action_print">打印结果</a>
          <% end %>
        </form>
      </th>
    </tr>
  </tfoot>
</table>
<div id="pager">
  <%= will_paginate @orders,:prev_label => '«上一页',:next_label => '下一页»' %>
</div>



